$.ajaxPrefilter(function (options) {
    options.url = 'http://api-breakingnews-web.itheima.net' + options.url
    if (options.url.indexOf('/my/') !== -1) {
        options.headers = {
            Authorization: localStorage.getitem('token')
        }
    }
    // 退出登录
    options.complete = function (xhr) {
        // console.log(xhr)
        // console.log(xhr,responseJSON)
        if (xhr.responseJSON.status === 1 && xhr.responseJSON.message === '身份认证失败！') {
            localStorage.removeItem('token')
            location.href = 'login.html'
        }
    }
})